#include "dominion.h"
#include "dominion_helpers.h"
#include <string.h>
#include <stdio.h>
#include <assert.h>
#include "rngs.h"

// set NOISY_TEST to 0 to remove printfs from output
#define NOISY_TEST 1

int main() {
	int i;
	int seed = 1000;
	int numPlayer = 2;
	int maxBonus = 10;
	int p, r, handCount;
	int bonus;
	int k[10] = {adventurer, council_room, feast, gardens, mine
	             , remodel, smithy, village, baron, great_hall};
	struct gameState G;

	printf ("TESTING isGameOver():\n");

	memset(&G, 23, sizeof(struct gameState));   // clear the game state
	r = initializeGame(numPlayer, k, seed, &G); // initialize a new game


	G.supplyCount[province] = 0;
	for (i = 0; i < 25; i++)
		G.supplyCount[i] = 0;
	assert(isGameOver(&G) == 1);

	G.supplyCount[province] = 1;
	for (i = 0; i < 25; i++)
		G.supplyCount[i] = 0;
	assert(isGameOver(&G) == 1);

	G.supplyCount[province] = 1;
	for (i = 0; i < 25; i++)
		G.supplyCount[i] = 1;
	assert(isGameOver(&G) == 0);

	G.supplyCount[province] = 1;
	for (i = 0; i < 25; i++)
		G.supplyCount[i] = 1;
	G.supplyCount[0] = 0;
	G.supplyCount[1] = 0;
	assert(isGameOver(&G) == 0);

	G.supplyCount[province] = 1;
	for (i = 0; i < 25; i++)
		G.supplyCount[i] = 1;
	G.supplyCount[0] = 0;
	G.supplyCount[1] = 0;
	G.supplyCount[2] = 0;
	assert(isGameOver(&G) == 1);


	printf("All tests passed!\n");
	
	return 0;
}
